<template>
  <div id="userInfo">
    <img :src="user.avatar" @click="clickUser">
    <span>{{user.nickname}}</span>
  </div>
</template>

<script>
export default {
  name: "SXQ-UserItem",
  props: ['user'],
  methods: {
    clickUser() {
      if (this.user.id) {
        this.$router.push({
          path: "/PersonalPage",
          query: {
            userId: this.user.id
          }
        }, () => {}, () => {})
      }
    }
  }
}
</script>

<style scoped>
#userInfo {
  width: 60px;
  height: fit-content;
  float: right;
  text-align: center;
  margin-top: 10px;
}

#userInfo>img{
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: inline-block;
  border-radius: 40px;
  border: black solid 2px;
}

#userInfo>span{
  vertical-align: top;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
}
</style>